﻿import QtQuick
import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts

Rectangle {

    ListView {
        id: listView
        anchors.fill: parent
        anchors.margins: 15
        spacing: 2
        clip:true
        boundsBehavior: Flickable.StopAtBounds // 不需要越界回弹
        orientation: ListView.Vertical //垂直列表
        delegate: itemCompare // Item 布局
        model: dataModel

        ScrollBar.vertical: ScrollBar {
            policy: ScrollBar.AlwaysOn
        }
    }

    Component {
        id: itemCompare
        Row {
            width: listView.width
            // height:50
            spacing: 10
            // delegate是第几个item也是index，避免冲突，可以提前存下来
            property int itemIndex: index

            Repeater {
                model: total // 重复次数
                Row {
                    Text {
                        text: three
                    }

                    Image {
                        source: "image://provider/item1/" + itemIndex + "/" + index // Repeater 中可以取到index获取重复第几次
                    }
                }
            }
        }
    }

}
